<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<html>
<head>
<fmt:setBundle basename="ApplicationResources" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title><fmt:message key="title.searchUser" /></title>
</head>
<body>
	<h2>
		<fmt:message key="title.maintainUser" />
	</h2>
	 <c:url var="url" scope="page" value="/pages/setupUser.jsp">
        		<c:param name="name" value=""/>
                <c:param name="description" value=""/>
                <c:param name="duration" value=""/>
                <c:param name="insert" value="true"/>
      </c:url>
    <a href="${url}"><fmt:message key="label.crudUser.add"/></a>
    <br></br>
    
	<h2>
		<fmt:message key="title.searchUser" />
	</h2>
	<form action="${pageContext.request.contextPath}/controller/searchUser"
		method=post>
		<fmt:message key="caption.searchUser" />
		<center>
			<table class="framed">
				<tr>
					<th width="45%"><fmt:message key="caption.name" /></th>
					<th width="55%"><fmt:message key="caption.desc" /></th>
				</tr>
				<tr>
					<td><fmt:message key="fieldLabel.username" /></td>
					<td><input type="text" name="name" size=45 maxlength=45></td>
				</tr>
				
				<tr>
					<td colspan="2" align="center"><input type="submit" value="Search"> </td>
				</tr>
				<tr bgcolor="">
					<td align=center colspan=2>
					<c:choose>
					<c:when test="${not empty errorMessage}">
										<p class="bodysmallred">${errorMessage}</p>
									</c:when>
					</c:choose>
					</td>
				</tr>
			</table>
		</center>

	</form>
	<c:if test="${! empty  searchUserList}">
		<table class="borderAll">
			<tr>
				<th><fmt:message key="label.crudUser.id" /></th>
				<th><fmt:message key="label.crudUser.name" /></th>
				<th><fmt:message key="label.crudUser.dob" /></th>
				<th><fmt:message key="label.crudUser.edit"/>&nbsp;<fmt:message key="label.crudUser.delete"/> 
				<fmt:message key="label.crudUser.updateEmployment"/> <fmt:message key="label.crudUser.resetUser"/></th>
			</tr>
			<c:forEach var="user" items="${searchUserList}" varStatus="status">
				<tr class="${status.index%2==0?'even':'odd'}">
					<td class="nowrap">${user.id}</td>
					<td class="nowrap">${user.name}</td>
					<td class="nowrap">${user.dob}</td>
					<td class="nowrap">
                        <c:url var="updurl" scope="page" value="/controller/updateUser">
                            <c:param name="name" value="${user.name}"/>
                            <c:param name="id" value="${user.id}"/>
							<c:param name="insert" value="false"/>
                        </c:url>
                        <a href="${updurl}"><fmt:message key="label.crudUser.edit"/></a>
                        &nbsp;&nbsp;&nbsp;
                        <c:url var="delurl" scope="page" value="/controller/deleteUser">
                            <c:param name="name" value="${user.name}"/>
                        </c:url>
                        <a href="${delurl}"><fmt:message key="label.crudUser.delete"/></a>
                        &nbsp;&nbsp;&nbsp;
                  		<a href="${updurl}"><fmt:message key="label.crudUser.updateEmployment"/></a>
                         &nbsp;&nbsp;&nbsp;
                        <c:url var="reseturl" scope="page" value="/controller/resetUser">
                            <c:param name="name" value="${user.name}"/>
                        </c:url>
                        <a href="${reseturl}"><fmt:message key="label.crudUser.resetUser"/></a>
                    </td>
				</tr>
			</c:forEach>
		</table>
	</c:if>

</body>
</html>